Skip to content

feat(skills): add writing-unit-tests and writing-integration-tests skills#37

Merged
TheRealAgentK merged 4 commits intomasterfrom
feat/add-writing-unit-tests-skill
Apr 22, 2026
Merged

feat(skills): add writing-unit-tests and writing-integration-tests skills#37
TheRealAgentK merged 4 commits intomasterfrom
feat/add-writing-unit-tests-skill

Conversation

@TheRealAgentK
Copy link
Copy Markdown
Collaborator

@TheRealAgentK TheRealAgentK commented Apr 21, 2026

Summary

Adds two new agent skills for writing pytest tests for Autohive integrations, plus updates to the existing upgrade skill.

writing-unit-tests (mock_context + FetchResponse pattern)

  • File structure — naming convention (test_*_unit.py), single vs split files for large integrations, boilerplate header
  • 6 test categories with concrete examples: happy path, request verification, error paths, edge cases, response shape, business logic
  • Mocking patterns — single fetch, multi-fetch side_effect, exceptions, DELETE 204, asyncio.sleep patching, env vars
  • Coverage expectations — target tests-per-action by integration size
  • 7 common gotchas — side_effect ordering, SDK validation, ActionError vs ActionResult, etc.

writing-integration-tests (live_context + aiohttp pattern)

  • File structure — naming convention (test_*_integration.py), double exclusion from CI (file naming + marker)
  • 3 live_context fixture variants — no auth (public APIs), API key auth, platform OAuth (token injection)
  • Environment variable handling — token setup, require_* skip helpers, .env.example documentation
  • Destructive marker@pytest.mark.destructive for write operations, separate run commands
  • Test patterns — chained tests (list → get), lifecycle tests (CRUD workflows), structural assertions
  • Coverage expectations — target tests by integration size
  • Reference implementations — hackernews, perplexity, bitly, hubspot

upgrading-sdk-v2 updates (Ninos's feedback)

  • Added ActionError with cost_usd example for cost-bearing error paths (e.g. billable API call fails)
  • Added conversion pattern for preserving cost_usd during migration
  • Added step to remove "error" property from action output schemas in config.json after migrating to ActionError
  • Added output schema cleanup to the checklist

Context

Built while migrating the HubSpot integration (48 actions, 256 unit tests, 41 integration tests). Codifies the patterns that emerged from that work so future integrations get consistent test coverage.

…ring

Covers file structure, 6 test categories (happy path, request verification,
error paths, edge cases, response shape, business logic), mocking patterns,
coverage expectations, and common gotchas.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 21, 2026

Coverage — 322d21d (docs(skills): update upgrading-sdk-v2 with ActionError cost_usd and output schema cleanup) by @TheRealAgentK

Total coverage: 100%

File Stmts Miss Cover Missing
src/autohive_integrations_sdk/__init__.py 2 0 100%
src/autohive_integrations_sdk/integration.py 358 0 100%

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 32ff626ab8

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread skills/writing-unit-tests/SKILL.md
@TheRealAgentK TheRealAgentK changed the title feat(skills): add writing-unit-tests skill for integration test authoring feat(skills): add writing-unit-tests and writing-integration-tests skills Apr 22, 2026
…utput schema cleanup

- Add ActionError with cost_usd example for cost-bearing error paths
- Add conversion pattern for preserving cost_usd during migration
- Add step to remove 'error' property from output schemas in config.json
- Add output schema cleanup to checklist

Addresses feedback from Ninos.
@TheRealAgentK TheRealAgentK merged commit 7bb6003 into master Apr 22, 2026
1 check passed
@TheRealAgentK TheRealAgentK deleted the feat/add-writing-unit-tests-skill branch April 22, 2026 03:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants